import requests
import json
from Common.connect_to_device import bucket_name
def clear_data(bucket_name):
   url = f"http://10.10.118.92:8086/api/v2/delete?org=perf&bucket={bucket_name}"

   payload = json.dumps({
      "start": "1997-03-01T00:00:00Z",
      "stop": "2030-11-14T00:00:00Z"
   })
   headers = {
      'Authorization': 'Token z7TVAZCoJY6T9bA1adSArAbddRqjhVOpGL1OD-ihe1ErnU4mYCknalpS0mXUa6U_D_w3kpqLvoXZsZutboy7MQ==',
      'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
      'Content-Type': 'application/json',
      'Accept': '*/*',
      'Host': '10.10.118.92:8086',
      'Connection': 'keep-alive'
   }

   response = requests.request("POST", url, headers=headers, data=payload)

   print(response.text)
if __name__=="__main__":
   # bucket_name="xjy_test"
   print(f"表名:{bucket_name} 已经清空")
   clear_data(bucket_name)